package com.qut.graduate.busrtquery.ui.common;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.TextView;

import com.mikepenz.google_material_typeface_library.GoogleMaterial;
import com.qut.graduate.busrtquery.BRTQConstant;
import com.qut.graduate.busrtquery.BaseActivity;
import com.qut.graduate.busrtquery.R;
import com.qut.graduate.busrtquery.utils.uiabout.StatusBarUtils;

/**
 * @Author WLL
 * @Time: 2019/5/16 9:32
 */
public class ConvenientActivity extends BaseActivity {
    private static final String TAG = "ConvenientActivity";
    private Toolbar toolbar;
    private TextView toolbarTitle;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_convenient;
    }

    @Override
    protected void init() {
        initView();
        initEvent();
    }

    private void initView() {
        toolbar = findViewById(R.id.toolbar);
        toolbarTitle = findViewById(R.id.toolbar_title);
        setSupportActionBar(toolbar);
    }

    private void initEvent() {
        Intent intent = getIntent();
        int ConvenientType = intent.getIntExtra("ConvenientType",0);
        if (ConvenientType == BRTQConstant.CONVENIENT_TYPE_NOTICE)
            toolbarTitle.setText("公告通知");
        if (ConvenientType == BRTQConstant.CONVENIENT_TYPE_SUBWAY)
            toolbarTitle.setText("地体信息");
        if (ConvenientType == BRTQConstant.CONVENIENT_TYPE_RECHARGE)
            toolbarTitle.setText("青岛通充值网点");

        toolbar.setNavigationIcon(getToolbarIcon(GoogleMaterial.Icon.gmd_arrow_back));
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }

    @Override
    public void onResume() {
        super.onResume();
        updateNowTheme();
    }

    @SuppressLint("ResourceAsColor")
    private void updateNowTheme() {
        toolbar.setPopupTheme(getPopupToolbarStyle());
        toolbar.setBackgroundColor(getPrimaryColor());
        toolbar.setTitle("");
        StatusBarUtils.fullScreen(this);
        updateBarColor();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }

}
